package com.pie4cloud.pie.job.biz.util;

import com.pie4cloud.pie.job.api.entity.PlaybillEntity;

import java.lang.reflect.Field;

public class ClassUtils {

	public static <T> String getClassValueByEntityAndName(T t,String name) {
		try {
			Class<?> aClass = t.getClass();
			Field tableName = aClass.getDeclaredField(name);
			tableName.setAccessible(true);
			Object o = tableName.get(t);
			if (o != null) {
				return o.toString();
			}
		} catch (NoSuchFieldException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}
		return null;
	}
}
